package com.example.demo.annatationtest;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

@Aspect
@Component
public class AdminOnlyAspect {

    @Pointcut("execution(public * com.example.demo.annatationtest.*(..))")
    public void adminOnlyMethods() {}

    @Before("adminOnlyMethods()")
    public void logBefore(JoinPoint joinPoint) {
        System.out.println("Before method in AdminOnly target: " + joinPoint.getSignature().getName());
    }
}